import Vue from 'vue'
import VueRouter from 'vue-router'

// 1.导入组件
import Main from '@/views/Main.vue'
import Login from '@/views/Login.vue'
import Register from '@/views/Register.vue'
// 2.导入二级路由
import Home from '@/views/Home/Home.vue'
import ArtCate from '@/views/Article/ArtCate.vue'
import ArtList from '@/views/Article/ArtList.vue'
import UserAvatar from '@/views/User/UserAvatar.vue'
import UserInfo from '@/views/User/UserInfo.vue'
import UserPwd from '@/views/User/UserPwd.vue'

Vue.use(VueRouter)

const routes = [
  {path: '/', component: Main, children: [
    {path: '/', component: Home},
    {path: '/home', component: Home},
    {path: '/art-cate', component: ArtCate},
    {path: '/art-list', component: ArtList},
    {path: '/user-avatar', component: UserAvatar},
    {path: '/user-info', component: UserInfo},
    {path: '/user-pwd', component: UserPwd},
  ]},
  {path: '/login', component: Login},
  {path: '/register', component: Register},
]

const router = new VueRouter({
  routes
})

export default router
